package com.nacos.example.config;

import com.alibaba.nacos.api.config.annotation.NacosConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author wy
 * @date 2022/04/24
 * @description
 * 使用@NacosConfigurationProperties读取nacos配置中心文件
 * 可以直接实现配置文件热更新
 * 在nacos配置中心新建：config-teacher.yaml
 * teacher:
 *   name: 老李
 *   age: 35
 *   修改config-teacher.yaml发布后，这里可以读取到修改后的值
 */

@Component
@NacosConfigurationProperties(dataId = "config-teacher.yaml", prefix = "teacher", autoRefreshed = true)
public class TestNacosConfiguration1 {

    private String name;
    private Integer age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
